﻿package cn.itcast.usermanage.pojo;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonIgnore;

@Table(name = "tb_user")
public class User implements Serializable {

	private static final long serialVersionUID = 1061141309455081495L;

	@GeneratedValue(generator = "JDBC")
	@Id
	private Long id;

	// 用户名
	@Column(name = "user_name")
	private String userName;

	// 密码
	// 由于密码也转为了json数据,在页面显示了
	// 当对象转化成了json时,忽略该属性
	@JsonIgnore
	private String password;

	// 姓名
	private String name;

	// 年龄
	private Integer age;

	// 性别，1男性，2女性
	private Integer sex;

	// 出生日期
	// form表单提交时,会将数据转化为json类型的字符串,SpringMVC提供了字符串装日期类型的机制
	@DateTimeFormat(pattern = "yyyy-MM-dd")
	private Date birthday;

	// 创建时间
	private Date created;

	// 更新时间
	private Date updated;

	// @Transient注解可以忽略字段,添加该注解的字段不会作为表字段使用
	@Transient
	private String remark;

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	public Integer getSex() {
		return sex;
	}

	public void setSex(Integer sex) {
		this.sex = sex;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	public Date getUpdated() {
		return updated;
	}

	public void setUpdated(Date updated) {
		this.updated = updated;
	}

	@Override
	public String toString() {
		return "User [id=" + id + ", userName=" + userName + ", password=" + password + ", name=" + name + ", age=" + age + ", sex=" + sex + ", birthday=" + birthday + ", created=" + created + ", updated=" + updated + "]";
	}

}
